package com.explore.demo.controller;


import com.explore.demo.common.ServerResponse;
import com.explore.demo.pojo.RecruitCategory;
import com.explore.demo.pojo.RowView;
import com.explore.demo.service.RecruitCategoryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gaolainan
 * @since 2021-05-04
 */
@RestController
@RequestMapping("/recruit_category")
public class RecruitCategoryController {

    @Resource
    private RecruitCategoryService recruitCategoryService;

    @GetMapping
    @ApiOperation("查询全部的信息")
    public ServerResponse query(){
        return recruitCategoryService.queryAll();
    }

    @PostMapping
    @ApiOperation("创建一个 招聘信息的关系类别")
    public ServerResponse addOne(RecruitCategory recruitCategory){
        return recruitCategoryService.addRecruitCategory(recruitCategory);
    }

    @DeleteMapping
    @ApiOperation("通过id  删除对应信息")
    public ServerResponse deleteById(Integer id){
        return recruitCategoryService.deleteById(id);
    }

    @PostMapping("/{recruitId}")
    @ApiOperation("根据招聘信息的id 查询对应的类别")
    public ServerResponse queryByUserId(@PathVariable("recruitId") Integer recruitId){
        return recruitCategoryService.queryAllByRecruitId(recruitId);
    }
}

